<html>
	{% include "../common_head.html" %}
	<body>
	{% include "../common_menus.html" %}
		<div id="content">
		
		<div id="rakontu_form_style" class="rakontu_form">
		<form action="/{{dir_visit}}/{{url_annotation}}?
		{% if annotation %}
			{{annotation.urlQuery}}
		{% else %}
			{{entry.urlQuery}}
		{% endif %}
		" method="post" enctype="multipart/form-data">
		
		{% ifequal annotation_type "comment" %}
			<h3>{{template_comment_on}} {{entry.linkString}}</h3>
			<fieldset>
			<p>{{template_subject}} <input type="text" name="shortString" size="80" value="{% if annotation %}{{annotation.shortString}}{% endif %}" maxlength="{{maxlength_subject_or_comment}}"/></p>
			<table style="width:100%; border:none">
			<tr><td class="noborder">
			<textarea name="longString" rows="10" cols="60">{% if annotation %}{{annotation.longString}}{% endif %}</textarea>
			</td><td class="noborder" width="80">
			<p>{{template_interpret_as}} {{"interpreting_texts"|tip}}</p>
				<select name="longString_format">
				{% for i in text_formats|makeRangeFromListLength %}
					<option value="{{text_formats|listLookup:i}}" 
					{% if annotation %}
						{% if text_formats|listLookup:i|equalTest:annotation.longString_format %}
							selected="selected"
						{% endif %}
					{% else %}
						{% if text_formats|listLookup:i|equalTest:current_member.preferredTextFormatt %}
							selected="selected"
						{% endif %}
					{% endif %}
					>{{text_formats_display|listLookup:i}}</option>
				{% endfor %}
				</select>
			</td></tr></table>
			{% include "../common_attribution.html" %}
			</fieldset>
		{% endifequal %}
		
		{% ifequal annotation_type "request" %}
			<h3>{{template_request_about}} {{entry.linkString}}</h3>
			<fieldset>
			{{template_subject}} <input type="text" name="shortString" size="80" value="{% if annotation %}{{annotation.shortString}}{% endif %}" maxlength="{{maxlength_subject_or_comment}}"/>
			<table style="width:100%; border:none">
			<tr><td class="noborder">
			<textarea name="longString" rows="10" cols="60">{% if annotation %}{{annotation.longString}}{% endif %}</textarea>
			</td><td class="noborder" width="80">
			<p>{{template_interpret_as}}</p>
				<select name="longString_format">
				{% for i in text_formats|makeRangeFromListLength %}
					<option value="{{text_formats|listLookup:i}}" 
					{% if annotation %}
						{% if text_formats|listLookup:i|equalTest:annotation.longString_format %}
							selected="selected"
						{% endif %}
					{% else %}
						{% if text_formats|listLookup:i|equalTest:current_member.preferredTextFormatt %}
							selected="selected"
						{% endif %}
					{% endif %}
					>{{text_formats_display|listLookup:i}}</option>
				{% endfor %}
				</select>
			</td></tr></table>
			<p>{{template_what_is_request_type}}
			<select name="typeIfRequest">
				<option name="none">({{term_choose}})</option>
				{% for type in request_types %}
					<option value="{{type}}"
					{% if annotation %}
						{% ifequal annotation.typeIfRequest type %}
							selected="selected"
						{% endifequal %}
					{% endif %}
					>{{type}}</option>
				{% endfor %}
				</select></p>
			{% include "../common_attribution.html" %}
			</fieldset>
		{% endifequal %}
		
		{% ifequal annotation_type "tag set" %}
			<h3>{{template_tag_set_for}} {{entry.linkString}}</h3>
			<fieldset>
			<p>{{template_enter_tags}}</p>
			<p>
			{% for i in num_tags_in_tag_set|makeRange %}
				{% if already_there_tags %}
					<select name="alreadyThereTag{{i}}">
					<option value="none">({{term_choose}})</option>
					{% for tag in already_there_tags %}
						{% if tag|orNothing %}
							<option value="{{tag}}"
							{% if annotation %}
								{% ifequal annotation.tagsIfTagSet|listLookup:i tag %}
									selected="selected"
								{% endifequal %}
							{% endif %}
							>{{tag}}</option>
						{% endif %}
					{% endfor %}
					</select>
				{% endif %}
				<input type="text" name="tag{{i}}" size="15" value="{% if annotation %}{{annotation.tagsIfTagSet|listLookup:i|orNothing}}{% endif %}" maxlength="{{maxlength_tag_or_choice}}"/>
				<br/> 
			{% endfor %}
			</p>
			{% include "../common_attribution.html" %}
			</fieldset>
		{% endifequal %}
		
		{% ifequal annotation_type "nudge" %}
			<h3>{{template_nudge_for}} {{entry.linkString}}</h3>
			<fieldset>
			<p>{{template_nudge_points_can_assign_to_entry}}: <b>{{nudge_points_member_can_assign}}</b> 
				{{"what_nudge_points_are_for"|info}} 
				{{"nudge_point_allocation"|caution}}</p>
			<p>{{template_nudge_points_member_has_left}}: <b>{{current_member.nudgePoints}}</b></p>
			<table class="noborder">
			{% for i in num_nudge_categories|makeRange %}
				{% if rakontu.nudgeCategories|listLookup:i %}
					<tr>
					<td class="noborder"><input type="text" name="nudge{{i}}" size="4" value="{{annotation.valuesIfNudge|listLookup:i|orNothing}}" maxlength="{{maxlength_number}}"/></td>
					<td class="noborder">
					{% if rakontu.nudgeCategoryQuestions|listLookup:i %}
						{{rakontu.nudgeCategoryQuestions|listLookup:i}}
						(<i>{{rakontu.nudgeCategories|listLookup:i}}</i>)
					{% else %}
						{{rakontu.nudgeCategories|listLookup:i}}
					{% endif %}
					</td>
					</tr>
				{% endif %}
			{% endfor %}
			</table>
			{{template_comment}} <input type="text" name="shortString" size="80" value="{% if annotation %}{{annotation.shortString}}{% endif %}" maxlength="{{maxlength_subject_or_comment}}"/>
			</p>
			{% include "../common_attribution.html" %}
			</fieldset>
		{% endifequal %}

			<p>
			<center>
			{% if annotation %}
				{% if annotation.inBatchEntryBuffer %}
					<input type="submit" name="save|{{annotation_type}}" value="{{button_save_changes_and_return}}" class="button">
					<input type="submit" name="preview|{{annotation_type}}" value="{{button_preview}}" class="button">
				{% else %}
					{% if annotation.isCommentOrRequest %}
						<input type="submit" name="preview|{{annotation_type}}" value="{{button_preview}}" class="button">
						<input type="submit" name="publish|{{annotation_type}}" value="{{button_publish}}" class="button">
					{% else %}
						<input type="submit" name="publish|{{annotation_type}}" value="{{button_add}}" class="button">
					{% endif %}
				{% endif %}
			{% else %}
				{% if annotation_type|isCommentOrRequest %}
					<input type="submit" name="preview|{{annotation_type}}" value="{{button_preview}}" class="button">
					<input type="submit" name="publish|{{annotation_type}}" value="{{button_publish}}" class="button">
				{% else %}
					<input type="submit" name="publish|{{annotation_type}}" value="{{button_add}}" class="button">
				{% endif %}
			{% endif %}
			</center>
			
		<p>{{entry.linkString}} ({{entry.typeForDisplay}})</p>
		{% include "read_or_preview_entry.html" %}
		</div>
		
		{% ifequal annotation_type "comment" %}
			{% if entry.hasComments %}
				<p>{{template_comments_on}} {{entry.linkString}}</p>
				{% for comment in entry.getComments %}
					<div class="blurb"><p><b>{{comment.shortString}}</b> -
					{% if comment.attributedToMember %}
							{% if comment.creator.active %}
								{{comment.creator.linkString}}
								{% ifequal comment.creator.key current_member.key %}
									 ({{template_you}})
								{% endifequal %}
							{% else %}
								{{template_the_former_member}} "{{comment.creator.nickname}}"
							{% endif %}
					{% else %}
						{% if comment.character.active %}
							{{comment.character.linkString}}
						{% else %}
							{{template_the_former_character}} "{{comment.character.name}}"
						{% endif %}
					{% endif %}
					{% if current_member.timeFormat %}
						{{comment.published|timeZone:current_member.timeZoneName|time:current_member.timeFormat}}
					{% endif %}
					{{comment.published|timeZone:current_member.timeZoneName|date:current_member.dateFormat}}
					</p>{{comment.longString_formatted}}</div>
				{% endfor %}
			{% endif %}
		{% endifequal %}

		{% ifequal annotation_type "tag set" %}
			{% if entry.hasTagSets %}
				<p>{{template_tag_sets_for}} {{entry.linkString}}</p>
				{% for tagset in entry.getTagSets %}
					<div class="blurb"><p>{{tagset.tagsIfTagSet|join:", "}} -
					{% if tagset.attributedToMember %}
							{% if tagset.creator.active %}
								{{tagset.creator.linkString}}
								{% ifequal tagset.creator.key current_member.key %}
									 ({{template_you}})
								{% endifequal %}
							{% else %}
								{{template_the_former_member}} "{{tagset.creator.nickname}}"
							{% endif %}
					{% else %}
						{% if tagset.character.active %}
							{{tagset.character.linkString}}
						{% else %}
							{{template_the_former_character}} "{{tagset.character.name}}"
						{% endif %}
					{% endif %}
					{% if current_member.timeFormat %}
						{{tagset.published|timeZone:current_member.timeZoneName|time:current_member.timeFormat}}
					{% endif %}
					{{tagset.published|timeZone:current_member.timeZoneName|date:current_member.dateFormat}}
					</p>
					{% if tagset.shortString %}
						{{comment.shortString}}
					{% endif %}
					</div>
				{% endfor %}
			{% endif %}
		{% endifequal %}
		
		{% ifequal annotation_type "request" %}
			{% if entry.hasRequests %}
				<p>{{template_requests_for}} {{entry.linkString}}</p>
				{% for request in entry.getRequests %}
					<div class="blurb"><p><b>{{request.shortString}}</b> -
					{% if request.attributedToMember %}
							{% if request.creator.active %}
								{{request.creator.linkString}}
								{% ifequal request.creator.key current_member.key %}
									 ({{template_you}})
								{% endifequal %}
							{% else %}
								{{template_the_former_member}} "{{request.creator.nickname}}"
							{% endif %}
					{% else %}
						{% if request.character.active %}
							{{request.character.linkString}}
						{% else %}
							{{template_the_former_character}} "{{request.character.name}}"
						{% endif %}
					{% endif %}
					{% if current_member.timeFormat %}
						{{request.published|timeZone:current_member.timeZoneName|time:current_member.timeFormat}}
					{% endif %}
					{{request.published|timeZone:current_member.timeZoneName|date:current_member.dateFormat}}
					</p>{{request.longString_formatted}}</div>
				{% endfor %}
			{% endif %}
		{% endifequal %}
		
		</form>
		</div>
		</div>
	{% include "../common_footer.html" %}
	</body>
</html>
